<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>
    <div id="box">
        <button @click="handleClick()">axios</button>

        <ul>
            <li v-for="item in datalist" :key="item.id">
                <img : src="item.img | kerwinfilter"/>
                <h3>{{item.nm}}</h3>
                <p>{{item.showInfo}}</p>
            </li>
        </ul>

        <div>{{'myname' | uppercase | sub }}</div> <!-- 过滤器链式调用 -->
    </div>

    <script type="text/javascript"> 
        Vue.filter("kerwinfilter", function (path){     //定义kerwinfilter，并通过 管道符送入filter中
            return path.replace('w.h', '')+'@1l_1e_1c_128w_180h'
        }) 

        Vue.filter("uppercase", function(str){
            return str.toUpperCase()
        })

        Vue.filter("sub", function(str){        //截取至上一层
            return str .substring(0, 2)

        })

        new Vue ({
            el:"#box",
            data: {
               
            },
            methods: {
               handleClick(){
                   axios.get("test.json").then(res =>{
                    //    console.log(res.data.movieList)
                
                   })
               }, 
            }
        })

        /* 
        
        axios.post("https:/xxxxxxx", "name = kerwin&age= 100").then(res =>{})

        axios.post("https:/xxxxxx", { 
            name:"kerwin", 
            age:100
        }).then(res => {})
        
        
        
        */

    </script>
</body>
</html>